home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C++ für Kids
/
C++ for kids.iso
/
Buch
/
Farbe0.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1999-01-06
|
2KB
|
50 lines
//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop
#include "Farbe0.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
const int FMax = 16;
TColor Farbe[FMax] =
{clBlack, clMaroon, clGreen, clNavy, clTeal, clPurple,
clOlive, clGray, clSilver, clRed, clLime, clBlue,
clAqua, clFuchsia, clYellow, clWhite};
String FarbName[FMax] =
{"Black", "Maroon", "Green", "Navy", "Teal", "Purple",
"Olive", "Gray", "Silver", "Red", "Lime", "Blue",
"Aqua", "Fuchsia", "Yellow", "White"};
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
for (int i=0; i<FMax/2; i++)
{
Canvas->Brush->Color = clBtnFace;
Canvas->TextOut (20,i*20+30,FarbName[i]);
Canvas->TextOut (80,i*20+30,String(Farbe[i]));
Canvas->Brush->Color = Farbe[i];
Canvas->TextOut (150,i*20+30, " ");
}
for (int i=FMax/2; i<FMax; i++)
{
Canvas->Brush->Color = clBtnFace;
Canvas->TextOut (ClientWidth/2+30,(i-FMax/2)*20+30,FarbName[i]);
Canvas->TextOut (ClientWidth/2+90,(i-FMax/2)*20+30,String(Farbe[i]));
Canvas->Brush->Color = Farbe[i];
Canvas->TextOut (ClientWidth/2+160,(i-FMax/2)*20+30, " ");
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
randomize ();
}
//---------------------------------------------------------------------------